[TAPDISK] handle error case when opening VDIs
authorJake Wires <jwires@xensource.com>
Fri, 23 Feb 2007 17:40:32 +0000 (09:40 -0800)
committerJake Wires <jwires@xensource.com>
Fri, 23 Feb 2007 17:40:32 +0000 (09:40 -0800)
tools/blktap/drivers/tapdisk.c

index 43a037a053070698fef408b5bbedc39b13ee41c5..965dbd9b7d2223b2e75dc94c030282fba7843c39 100644 (file)
@@ -306,8 +306,11 @@ static int open_disk(struct td_state *s, struct tap_disk *drv, char *path)
                return -ENOMEM;
 
        err = drv->td_open(d, path, 0);
-       if (err)
-               goto fail;
+       if (err) {
+               free_driver(d);
+               s->disks = NULL;
+               return -ENOMEM;
+       }
 
        /* load backing files as necessary */
        while ((err = d->drv->td_get_parent_id(d, &id)) == 0) {